<HTML>
  <HEAD>
    <TITLE>threadpool Documentation</TITLE>
    <LINK HREF="threadpool.css" REL="stylesheet" TYPE="text/css">
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">

    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>

          <TD ALIGN="LEFT">
            <B>threadpool</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>

        </TR>
      </TABLE>
    </DIV>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
          <TD ALIGN="LEFT">
            <B>Reference</B>
          </TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="annotated.html">Class List</A> |
            <A CLASS="qindex" HREF="functions.html">Member Functions</A> |
            <A CLASS="qindex" HREF="namespacemembers.html">Typedefs</A> |
            <A CLASS="qindex" HREF="files.html">File List</A>
          </TD>
        </TR>
      </TABLE>
    </DIV>
<!-- Generated by Doxygen 1.4.6-NO -->
<div class="nav">
<a class="el" href="a00035.html">boost</a>::<a class="el" href="a00036.html">threadpool</a>::<a class="el" href="a00024.html">thread_pool</a></div>
<h1>boost::threadpool::thread_pool&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt; Class Template Reference</h1><!-- doxytag: class="boost::threadpool::thread_pool" --><a href="a00002.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt;<br>
 class boost::threadpool::thread_pool&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;</h3>

Thread pool. 
<p>
Thread pools are a mechanism for asynchronous and parallel processing within the same process. The pool class provides a convenient way for dispatching asynchronous tasks as functions objects. The scheduling of these tasks can be easily controlled by using customized schedulers. A task must not throw an exception.<p>
A pool is DefaultConstructible, CopyConstructible and Assignable. It has reference semantics; all copies of the same pool are equivalent and interchangeable. All operations on a pool except assignment are strongly thread safe or sequentially consistent; that is, the behavior of concurrent calls is as if the calls have been issued sequentially in an unspecified order.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>Task</em>&nbsp;</td><td>A function object which implements the operator 'void operator() (void) const'. The operator () is called by the pool to execute the task. Exceptions are ignored. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>SchedulingPolicy</em>&nbsp;</td><td>A task container which determines how tasks are scheduled. It is guaranteed that this container is accessed only by one thread at a time. The scheduler shall not throw exceptions.</td></tr>
  </table>
</dl>
<dl compact><dt><b>Remarks:</b></dt><dd>The pool class is thread-safe.</dd></dl>
<dl compact><dt><b>See also:</b></dt><dd>Tasks: <a class="el" href="a00036.html#c6f15485d0c9225572afc57b30f50358">task_func</a>, <a class="el" href="a00021.html">prio_task_func</a> <p>
Scheduling policies: <a class="el" href="a00016.html">fifo_scheduler</a>, <a class="el" href="a00018.html">lifo_scheduler</a>, <a class="el" href="a00020.html">prio_scheduler</a> </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a00039.html#l00073">73</a> of file <a class="el" href="a00039.html">pool.hpp</a>.<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef SchedulingPolicy&lt;<br>
 <a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a> &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#4bdb3cef94393456f2b7ec0d171d6b11">scheduler_type</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef SizePolicyController&lt;<br>
 pool_core_type &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#c7e01650ffec650c0279782eacb4be80">size_controller_type</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef SizePolicy&lt; pool_core_type &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#654dc8a75dc2ea813dc6307f8707658d">size_policy_type</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef Task&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a></td></tr>

<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#ab990245fb601499bc768737f65b09b2">active</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#9d98ecc57fb790ad12e9c12dcead921b">clear</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#4d8cacdeef78219399343a0bea999212">empty</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#1cea841e4310d6ff8a09f3f81124f45b">pending</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#3daf5e17f6c2ba9a0ecdeb73b41478e6">schedule</a> (<a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a> const &amp;task)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#f0d21c4108b9808946ed8dabbbe2687f">size</a> () const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00024.html#c7e01650ffec650c0279782eacb4be80">size_controller_type</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#965f249200025312bd3a3a0f8144e3a5">size_controller</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#6eba12acd49dfe14c7de44073a138aa1">thread_pool</a> (size_t initial_threads=0)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#f229154a61cb29bc3ce969974eca3175">wait</a> (xtime const &amp;timestamp, size_t task_threshold=0) const </td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#dc8ccb7588160208ea0fd1d84b58269e">wait</a> (size_t task_threshold=0) const </td></tr>

</table>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="4bdb3cef94393456f2b7ec0d171d6b11"></a><!-- doxytag: member="boost::threadpool::thread_pool::scheduler_type" ref="4bdb3cef94393456f2b7ec0d171d6b11" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">typedef SchedulingPolicy&lt;<a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a>&gt; <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::<a class="el" href="a00024.html#4bdb3cef94393456f2b7ec0d171d6b11">scheduler_type</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Indicates the scheduler's type. 
<p>

<p>
Definition at line <a class="el" href="a00039.html#l00085">85</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="c7e01650ffec650c0279782eacb4be80"></a><!-- doxytag: member="boost::threadpool::thread_pool::size_controller_type" ref="c7e01650ffec650c0279782eacb4be80" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">typedef SizePolicyController&lt;pool_core_type&gt; <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::<a class="el" href="a00024.html#c7e01650ffec650c0279782eacb4be80">size_controller_type</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a00039.html#l00092">92</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="654dc8a75dc2ea813dc6307f8707658d"></a><!-- doxytag: member="boost::threadpool::thread_pool::size_policy_type" ref="654dc8a75dc2ea813dc6307f8707658d" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">typedef SizePolicy&lt;pool_core_type&gt; <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::<a class="el" href="a00024.html#654dc8a75dc2ea813dc6307f8707658d">size_policy_type</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a00039.html#l00091">91</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="321da9e252f14645cd3e433305576a4b"></a><!-- doxytag: member="boost::threadpool::thread_pool::task_type" ref="321da9e252f14645cd3e433305576a4b" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">typedef Task <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::<a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Indicates the task's type. 
<p>

<p>
Definition at line <a class="el" href="a00039.html#l00084">84</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="6eba12acd49dfe14c7de44073a138aa1"></a><!-- doxytag: member="boost::threadpool::thread_pool::thread_pool" ref="6eba12acd49dfe14c7de44073a138aa1" args="(size_t initial_threads=0)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::<a class="el" href="a00024.html">thread_pool</a>           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>initial_threads</em> = <code>0</code>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Constructor. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>initial_threads</em>&nbsp;</td><td>The pool is immediately resized to set the specified number of threads. The pool's actual number threads depends on the SizePolicy. </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00039.html#l00099">99</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="ab990245fb601499bc768737f65b09b2"></a><!-- doxytag: member="boost::threadpool::thread_pool::active" ref="ab990245fb601499bc768737f65b09b2" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">size_t <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::active           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns the number of tasks which are currently executed. <dl compact><dt><b>Returns:</b></dt><dd>The number of active tasks. </dd></dl>

<p>
Definition at line <a class="el" href="a00039.html#l00139">139</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="9d98ecc57fb790ad12e9c12dcead921b"></a><!-- doxytag: member="boost::threadpool::thread_pool::clear" ref="9d98ecc57fb790ad12e9c12dcead921b" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::clear           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Removes all pending tasks from the pool's scheduler. 
<p>
Definition at line <a class="el" href="a00039.html#l00156">156</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="4d8cacdeef78219399343a0bea999212"></a><!-- doxytag: member="boost::threadpool::thread_pool::empty" ref="4d8cacdeef78219399343a0bea999212" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">bool <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::empty           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Indicates that there are no tasks pending. <dl compact><dt><b>Returns:</b></dt><dd>true if there are no tasks ready for execution. </dd></dl>
<dl compact><dt><b>Remarks:</b></dt><dd>This function is more efficient that the check 'pending() == 0'. </dd></dl>

<p>
Definition at line <a class="el" href="a00039.html#l00166">166</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="1cea841e4310d6ff8a09f3f81124f45b"></a><!-- doxytag: member="boost::threadpool::thread_pool::pending" ref="1cea841e4310d6ff8a09f3f81124f45b" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">size_t <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::pending           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns the number of tasks which are ready for execution. <dl compact><dt><b>Returns:</b></dt><dd>The number of pending tasks. </dd></dl>

<p>
Definition at line <a class="el" href="a00039.html#l00148">148</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="3daf5e17f6c2ba9a0ecdeb73b41478e6"></a><!-- doxytag: member="boost::threadpool::thread_pool::schedule" ref="3daf5e17f6c2ba9a0ecdeb73b41478e6" args="(task_type const &amp;task)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">bool <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::schedule           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a> const &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>task</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Schedules a task for asynchronous execution. The task will be executed once only. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>task</em>&nbsp;</td><td>The task function object. It should not throw execeptions. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>true, if the task could be scheduled and false otherwise. </dd></dl>

<p>
Definition at line <a class="el" href="a00039.html#l00130">130</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="f0d21c4108b9808946ed8dabbbe2687f"></a><!-- doxytag: member="boost::threadpool::thread_pool::size" ref="f0d21c4108b9808946ed8dabbbe2687f" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">size_t <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::size           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Gets the number of threads in the pool. <dl compact><dt><b>Returns:</b></dt><dd>The number of threads. </dd></dl>

<p>
Definition at line <a class="el" href="a00039.html#l00120">120</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="965f249200025312bd3a3a0f8144e3a5"></a><!-- doxytag: member="boost::threadpool::thread_pool::size_controller" ref="965f249200025312bd3a3a0f8144e3a5" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="a00024.html#c7e01650ffec650c0279782eacb4be80">size_controller_type</a> <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::size_controller           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Gets the size controller which manages the number of threads in the pool. <dl compact><dt><b>Returns:</b></dt><dd>The size controller. </dd></dl>
<dl compact><dt><b>See also:</b></dt><dd>SizePolicy </dd></dl>

<p>
Definition at line <a class="el" href="a00039.html#l00111">111</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="f229154a61cb29bc3ce969974eca3175"></a><!-- doxytag: member="boost::threadpool::thread_pool::wait" ref="f229154a61cb29bc3ce969974eca3175" args="(xtime const &amp;timestamp, size_t task_threshold=0) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">bool <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::wait           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">xtime const &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>timestamp</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap> <em>task_threshold</em> = <code>0</code></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The current thread of execution is blocked until the timestamp is met or the sum of all active and pending tasks is equal or less than a given threshold. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timestamp</em>&nbsp;</td><td>The time when function returns at the latest. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>task_threshold</em>&nbsp;</td><td>The maximum number of tasks in pool and scheduler. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>true if the task sum is equal or less than the threshold, false otherwise. </dd></dl>

<p>
Definition at line <a class="el" href="a00039.html#l00189">189</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
<a class="anchor" name="dc8ccb7588160208ea0fd1d84b58269e"></a><!-- doxytag: member="boost::threadpool::thread_pool::wait" ref="dc8ccb7588160208ea0fd1d84b58269e" args="(size_t task_threshold=0) const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;typename Task = task_func, template&lt; typename &gt; class SchedulingPolicy = fifo_scheduler, template&lt; typename &gt; class SizePolicy = static_size, template&lt; typename &gt; class SizePolicyController = resize_controller, template&lt; typename &gt; class ShutdownPolicy = wait_for_all_tasks&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void <a class="el" href="a00024.html">boost::threadpool::thread_pool</a>&lt; Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy &gt;::wait           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>task_threshold</em> = <code>0</code>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The current thread of execution is blocked until the sum of all active and pending tasks is equal or less than a given threshold. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>task_threshold</em>&nbsp;</td><td>The maximum number of tasks in pool and scheduler. </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00039.html#l00176">176</a> of file <a class="el" href="a00039.html">pool.hpp</a>.    </td>
  </tr>
</table>
    <BR>
    <DIV CLASS="qindex">
      <TABLE BORDER="0" WIDTH="100%">
        <TR>
		  <TD CLASS="tiny" ALIGN="LEFT">Copyright &copy 2005-2007 Philipp Henkel</TD>
          <TD ALIGN="RIGHT">
            <A CLASS="qindex" HREF="../index.html">Overview</A> |
            <A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
            <A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
            <A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
            <A CLASS="qindex" HREF="../design/intro.html">Design</A>
          </TD>
        </TR>       
      </TABLE>
    </DIV>  
  </BODY>
</HTML>
